package com.greentravel.model;

import java.util.Date;

/**
 * 出行记录实体类
 * 存储用户的绿色出行记录信息
 */
public class TravelRecord {
    private int id; // 记录ID
    private int userId; // 用户ID
    private Date travelTime; // 出行时间
    private String travelMode; // 出行方式
    private String startLocation; // 起始地点
    private String endLocation; // 终点
    private double distance; // 出行距离（公里）
    private double carbonReduction; // 碳减排量（千克）
    private int points; // 获得积分

    // 默认构造方法
    public TravelRecord() {
    }

    // 带参数的构造方法
    public TravelRecord(int id, int userId, Date travelTime, String travelMode, String startLocation,
            String endLocation, double distance, double carbonReduction, int points) {
        this.id = id;
        this.userId = userId;
        this.travelTime = travelTime;
        this.travelMode = travelMode;
        this.startLocation = startLocation;
        this.endLocation = endLocation;
        this.distance = distance;
        this.carbonReduction = carbonReduction;
        this.points = points;
    }

    // 新增记录用的构造方法
    public TravelRecord(int userId, Date travelTime, String travelMode, String startLocation,
            String endLocation, double distance) {
        this.userId = userId;
        this.travelTime = travelTime;
        this.travelMode = travelMode;
        this.startLocation = startLocation;
        this.endLocation = endLocation;
        this.distance = distance;
        // 碳减排和积分在Service层计算
    }

    // getter和setter方法
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public Date getTravelTime() {
        return travelTime;
    }

    public void setTravelTime(Date travelTime) {
        this.travelTime = travelTime;
    }

    public String getTravelMode() {
        return travelMode;
    }

    public void setTravelMode(String travelMode) {
        this.travelMode = travelMode;
    }

    public String getStartLocation() {
        return startLocation;
    }

    public void setStartLocation(String startLocation) {
        this.startLocation = startLocation;
    }

    public String getEndLocation() {
        return endLocation;
    }

    public void setEndLocation(String endLocation) {
        this.endLocation = endLocation;
    }

    public double getDistance() {
        return distance;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    public double getCarbonReduction() {
        return carbonReduction;
    }

    public void setCarbonReduction(double carbonReduction) {
        this.carbonReduction = carbonReduction;
    }

    public int getPoints() {
        return points;
    }

    public void setPoints(int points) {
        this.points = points;
    }

    @Override
    public String toString() {
        return "TravelRecord{" +
                "id=" + id +
                ", userId=" + userId +
                ", travelTime=" + travelTime +
                ", travelMode='" + travelMode + '\'' +
                ", startLocation='" + startLocation + '\'' +
                ", endLocation='" + endLocation + '\'' +
                ", distance=" + distance +
                ", carbonReduction=" + carbonReduction +
                ", points=" + points +
                '}';
    }
}